﻿using NetworkLib.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PBO.Network.Domain
{
    public class PokemonSnapshot : DataByteArray
    {
        public int Identity { get; set; }
        public string Nickname { get; set; }
        public short Hp { get; set; }
        public short MaxHp { get; set; }
        public byte Gender { get; set; }
        public byte Lv { get; set; }
        public byte State { get; set; }
        public bool Substituded { get; set; }
        public bool Hid { get; set; }

        #region abstract

        public override void Read(ByteArray byteArray)
        {
            this.Identity = byteArray.ReadInt();
            this.Nickname = byteArray.ReadUTF();
            this.Hp = byteArray.ReadShort();
            this.MaxHp = byteArray.ReadShort();
            this.Gender = byteArray.ReadByte();
            this.Lv = byteArray.ReadByte();
            this.State = byteArray.ReadByte();
            this.Substituded = byteArray.ReadBoolean();
            this.Hid = byteArray.ReadBoolean();
        }

        public override void Write(ByteArray byteArray)
        {
            byteArray.WriteInt(this.Identity);
            byteArray.WriteUTF(this.Nickname);
            byteArray.WriteShort(this.Hp);
            byteArray.WriteShort(this.MaxHp);
            byteArray.WriteByte(this.Gender);
            byteArray.WriteByte(this.Lv);
            byteArray.WriteByte(this.State);
            byteArray.WriteBoolean(this.Substituded);
            byteArray.WriteBoolean(this.Hid);
        }

        #endregion
    }
}
